home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume24 / yabbawhap / part03 < prev    next >
Encoding:
Internet Message Format  |  1991-10-09  |  54.1 KB

  1. Subject:  v24i075:  Public-domain replacement for compress programs, Part03/04
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: db10e3bf d4d49c41 27b2b1fb b1ebd740
  5.  
  6. Submitted-by: Dan Bernstein <brnstnd@nyu.edu>
  7. Posting-number: Volume 24, Issue 75
  8. Archive-name: yabbawhap/part03
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  BLURB CHANGES INSTALL PATENTS QUESTIONS bitout.c huptrie.h
  17. #   percent.c sysconf texts.c unwhap.c unyabba.1 yabba.1
  18. # Wrapped by rsalz@litchi.bbn.com on Wed Mar 20 17:09:24 1991
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. echo If this archive is complete, you will see the following message:
  21. echo '          "shar: End of archive 3 (of 4)."'
  22. if test -f 'BLURB' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'BLURB'\"
  24. else
  25.   echo shar: Extracting \"'BLURB'\" \(1000 characters\)
  26.   sed "s/^X//" >'BLURB' <<'END_OF_FILE'
  27. XThis package includes yabba and unyabba, portable implementations of Y
  28. Xcoding. Y coding is unpatented---unlike the LZW coding used by compress
  29. Xand the LZ78 variants used by most other dictionary compressors. Y also
  30. Xgives somewhat better compression than LZW.
  31. X
  32. XAs an extra bonus, this package also includes whap and unwhap, portable
  33. Ximplementations of AP coding. AP coding is patented, but like Y it is
  34. Xmore effective than LZW. whap runs about as fast as compress and, in its
  35. Xdefault configuration, uses less memory; unwhap runs as fast as
  36. Xuncompress and uses less than half as much memory.
  37. X
  38. XThe entire package is public-domain. You can copy my Y code into any
  39. Xapplication without fear of copyrights or patents. Be aware, however,
  40. Xthat the current implementation is probably not too close to optimal,
  41. Xand I am actively searching for a better method. If AP were not patented
  42. XI would recommend that you use it instead. For more information see
  43. XPATENTS in the package.
  44. X
  45. X---Dan Bernstein, brnstnd@nyu.edu
  46. END_OF_FILE
  47.   if test 1000 -ne `wc -c <'BLURB'`; then
  48.     echo shar: \"'BLURB'\" unpacked with wrong size!
  49.   fi
  50.   # end of 'BLURB'
  51. fi
  52. if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  53.   echo shar: Will not clobber existing file \"'CHANGES'\"
  54. else
  55.   echo shar: Extracting \"'CHANGES'\" \(2782 characters\)
  56.   sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
  57. Xyabbawhap change file, in reverse chronological order
  58. X
  59. XEF is Eirik Fuller <eirik@theory.tn.cornell.edu>.
  60. XDG is Dave Gudeman <gudeman@cs.arizona.edu>.
  61. XMA is Marc Andreessen <andreessen@uimrl7.mrl.uiuc.edu>.
  62. XLR is Loren J. Rittle <cs326ag@ux1.cso.uiuc.edu>.
  63. XCP is Colin Plumb <ccplumb@rose.waterloo.edu>.
  64. XFW is Frank Wales <frank@grep.co.uk>.
  65. XGT is Graham Thoal <gtoal@ed.ac.uk>.
  66. X
  67. X3/19/91: yabbawhap 1.00.
  68. X3/19/91: Cleaned up for 1.00 release. Hopefully no further changes.
  69. X3/19/91: Changed >> 4 to / 16 to handle longs. Tnx GT.
  70. X3/19/91: Added ycoding.4b, latest revision of paper.
  71. X3/19/91: No major changes in a while, release seems appropriate.
  72. X
  73. X3/14/91: Fixed up various other %d and %ld's. Tnx GT.
  74. X3/14/91: Changed %d to %ld for per. Tnx GT.
  75. X3/14/91: Fixed 9999% to 9999%%. (Will this ever matter?) Tnx GT.
  76. X
  77. X3/13/91: Had OPTCANT2 and OPTCANT1 affect DOWNI. I don't like this...
  78. X3/13/91: Replaced DOWN2 with DOWNI (``down inner'') in yw.c, unyabba.c.
  79. X3/13/91: Added -s to ls in try, tryap.
  80. X3/13/91: Noted try* changes in README.
  81. X3/13/91: Removed -L from ls's in try*. Tnx FW.
  82. X3/13/91: Removed test -s stuff from try*. csh's too incompatible. Tnx FW.
  83. X3/13/91: Changed .memset.$$.* to .mmset.$$.* in sysconf. Tnx FW.
  84. X3/13/91: Added space before comment line 25 huptrie.h. Tnx FW.
  85. X     Microsoft SCO compiler reports error on int */*comment*/. Dorks.
  86. X
  87. X3/6/91: yabbawhap 0.981.
  88. X3/6/91: Took out test code from yw.c. Aargh.
  89. X
  90. X3/6/91: yabbawhap 0.98.
  91. X3/6/91: Fixed up .h dependencies in Makefile.
  92. X
  93. X2/27/91: Added HASHPTRS to huptrie.h. Only visible change is tophash().
  94. X2/27/91: Fixed up ADDAVAIL, INIT, and extra hc parens, just in case. Tnx CP.
  95. X2/27/91: Noted in Makefile and QUESTIONS that HASHTYPE does affect memory.
  96. X2/27/91: Changed initial ADDs in yw.c to use curhash as a temporary.
  97. X2/25/91: Added QUESTIONS.
  98. X
  99. X2/20/91: Fixed unsigned long return in percent.c. Tnx LR.
  100. X2/20/91: Fixed goaheadandbeverbose() and initrandom() to void returns. Tnx LR.
  101. X2/20/91: Changed unwhap logic slightly.
  102. X2/19/91: Changed sysconf to automatically run checkconf if the user wants.
  103. X2/19/91: Added warning in README about ZEROFILLED.
  104. X2/19/91: Added warning in README about changing -m. Tnx DG.
  105. X2/19/91: Changed to -UZEROFILLED as the default; sysconf sets -DZEROFILLED.
  106. X2/19/91: Changed whap to unwhap in unyabba man page. Tnx MA.
  107. X2/19/91: Changed tryap and tryapy to interact better with whapwarning. Tnx DG.
  108. X2/19/91: Fixed up non-use of BRAINDAMAGED in un*.
  109. X2/19/91: Added DOWN1, DOWN0, OPTCANT2, OPTCANT1.
  110. X2/18/91: Changed BRAINDAMAGED test slightly for Utek and similar. Tnx EF.
  111. X2/18/91: Fixed up sysconf's BRAINDAMAGED test. Oops. Tnx EF.
  112. X2/18/91: Added notice about checkconf to the end of sysconf.
  113. X2/18/91: Changed sysconf to use cat << instead of echo. I hate System V.
  114. X
  115. X2/17/91: yabbawhap 0.95.
  116. END_OF_FILE
  117.   if test 2782 -ne `wc -c <'CHANGES'`; then
  118.     echo shar: \"'CHANGES'\" unpacked with wrong size!
  119.   fi
  120.   # end of 'CHANGES'
  121. fi
  122. if test -f 'INSTALL' -a "${1}" != "-c" ; then 
  123.   echo shar: Will not clobber existing file \"'INSTALL'\"
  124. else
  125.   echo shar: Extracting \"'INSTALL'\" \(1302 characters\)
  126.   sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
  127. X#!/bin/sh
  128. X# Public domain.
  129. X
  130. XMODE=0755
  131. X
  132. XYABBA=/usr/local/bin/yabba
  133. XUNYABBA=/usr/local/bin/unyabba
  134. XWHAP=/usr/local/bin/whap
  135. XUNWHAP=/usr/local/bin/unwhap
  136. X
  137. XMYABBA=/usr/man/man1/yabba.1
  138. XMUNYABBA=/usr/man/man1/unyabba.1
  139. X
  140. Xecho "Each action will be printed before it is run. Press return to proceed."
  141. Xecho "Note that you need a BSD-compatible install program or script."
  142. X
  143. Xecho "1. Install yabba and unyabba."
  144. Xecho "! install -c -m $MODE yabba $YABBA: " | tr -d '\012'
  145. Xread line
  146. Xinstall -c -m "$MODE" yabba "$YABBA"
  147. X
  148. Xecho "! install -c -m $MODE unyabba $UNYABBA: " | tr -d '\012'
  149. Xread line
  150. Xinstall -c -m "$MODE" unyabba "$UNYABBA"
  151. X
  152. Xecho "2. Install whap and unwhap."
  153. Xif test -r whap -a -r unwhap
  154. Xthen echo "! install -c -m $MODE whap $WHAP: " | tr -d '\012'
  155. X     read line
  156. X     install -c -m "$MODE" whap "$WHAP"
  157. X
  158. X     echo "! install -c -m $MODE unwhap $UNWHAP: " | tr -d '\012'
  159. X     read line
  160. X     install -c -m "$MODE" unwhap "$UNWHAP"
  161. X
  162. Xelse echo "Looks like you don't have whap compiled. Fine, let's continue."
  163. Xfi
  164. X
  165. Xecho "3. Make the man pages available."
  166. Xecho "! install -c -m 0444 yabba.1 $MYABBA: " | tr -d '\012'
  167. Xread line
  168. Xinstall -c -m 0444 yabba.1 "$MYABBA"
  169. X
  170. Xecho "! install -c -m 0444 unyabba.1 $MUNYABBA: " | tr -d '\012'
  171. Xread line
  172. Xinstall -c -m 0444 unyabba.1 "$MUNYABBA"
  173. X
  174. Xecho "That's it!"
  175. X
  176. Xexit 0
  177. END_OF_FILE
  178.   if test 1302 -ne `wc -c <'INSTALL'`; then
  179.     echo shar: \"'INSTALL'\" unpacked with wrong size!
  180.   fi
  181.   chmod +x 'INSTALL'
  182.   # end of 'INSTALL'
  183. fi
  184. if test -f 'PATENTS' -a "${1}" != "-c" ; then 
  185.   echo shar: Will not clobber existing file \"'PATENTS'\"
  186. else
  187.   echo shar: Extracting \"'PATENTS'\" \(4266 characters\)
  188.   sed "s/^X//" >'PATENTS' <<'END_OF_FILE'
  189. XAfter someone patents a product or method that he invented, he can sue
  190. Xanyone who makes, uses, or sells the invention. You've probably heard
  191. Xthat Welch at Unisys patented LZW compression some years back, and so
  192. XUnisys can sue anyone who uses UNIX compress or any similar program.
  193. XYou may not have heard that Miller and Wegman at IBM independently
  194. Xdiscovered several compression methods, including LZW---and sent their
  195. Xpatent application to the Patent & Trademark Office before Welch did.
  196. XSo it appears that IBM controls LZW.
  197. X
  198. XHow can Unisys patent something that IBM already patented? And how can
  199. Xeither of them patent what are obviously mathematical algorithms, when
  200. Xmathematical algorithms aren't supposed to be patentable? The answer is
  201. Xthat the Patent & Trademark Office doesn't let mathematicians and
  202. Xcomputer scientists become patent examiners. So none of their examiners
  203. Xcan recognize mathematics without a court order, and even then they have
  204. Xtrouble. They also can't tell that two patents cover exactly the same
  205. Xalgorithm when the wording is slightly different.
  206. X
  207. XPractically every good compression method in the last ten years has been
  208. Xpatented. Modem and disk manufacturers can't ignore the possibility of
  209. Xgovernment-approved monopolies on compressors: there's too much money at
  210. Xstake. So they apply for one patent after another, twisting the wording
  211. Xas much as possible so that the patent examiners don't realize they're
  212. Xpatenting mathematics. By and large, they succeed.
  213. X
  214. XOn December 26, 1990, I discovered an apparently new compression method,
  215. XY coding. I haven't found a way to make Y run as fast as compress (yet),
  216. Xbut it's not too slow for general use, and it produces better results
  217. Xoverall than any other non-Huffman dictionary compressor I've seen. I am
  218. Xsick and tired of having to tiptoe through this minefield of patents; I
  219. Xwant a method that produces good results and can be used freely by
  220. Xanyone. Well, now I have it. Everything in Y coding is public domain. No
  221. Xcopyrights, no patents, no protection at all, on the code or on the
  222. Xalgorithms or on the file format or on anything else. I can't be totally
  223. Xsure, of course, that I'm the first to discover Y, but everyone I've
  224. Xtalked to thinks it's new. Use it as you will.
  225. X
  226. XSeveral months before I found Y coding, I found what I now know to be
  227. XStorer's AP coding. At first I thought it was new, and I started putting
  228. Xtogether an implementation. It's quite a bit faster than my Y
  229. Ximplementation---even faster than compress on some machines---and uses
  230. Xless memory. But it has turned out to be patented. I've included the
  231. Xcode in my Y package because I don't want my work to go to waste, but it
  232. Xcan't be used freely. You can use AP for what's sometimes called
  233. X``experimental use''; the precise wording in most court cases is ``for
  234. Xthe sole purpose of satisfying philosophical taste or curiosity, or for
  235. Xinstruction and amusement.'' Patents never apply to that sort of use.
  236. X
  237. XIf you like AP's efficiency and want to start using it for more than
  238. Xsatisfying your philosophical curiosity, you might be tempted to ask
  239. XStorer for a license. Don't give in! First, his patent---any compression
  240. Xpatent---is on very shaky ground, and as it hasn't been acknowledged in
  241. Xthe industry, it's even weaker. Second, you can challenge the patent by
  242. Xsending the Patent & Trademark Office about $2000 and an explanation of
  243. Xwhy AP is a mathematical algorithm. Now you may not have the money or
  244. Xlawyers or time or energy to do this successfully, but there are a lot
  245. Xof people who feel just as restricted. You should check up on the League
  246. Xfor Programming Freedom; if you don't subscribe to their political goals
  247. Xbut still want to get rid of compression patents, send me a note. In any
  248. Xcase this will be cheaper on everyone than paying Storer for something
  249. Xhe shouldn't even control. Third, Y isn't that much slower than AP, and
  250. Xit compresses just as effectively. Chances are good that I or someone
  251. Xelse will find a faster implementation soon. Finally, we may be able to
  252. Xconvince Storer to donate his patent to the public good. If you want to
  253. Xappeal to his morals, send a note to storer@cs.brandeis.edu, copy to
  254. Xbrnstnd@nyu.edu.
  255. X
  256. XDisclaimer: I'm not a lawyer. I'm just an outraged citizen.
  257. X
  258. X---Dan Bernstein, brnstnd@nyu.edu
  259. END_OF_FILE
  260.   if test 4266 -ne `wc -c <'PATENTS'`; then
  261.     echo shar: \"'PATENTS'\" unpacked with wrong size!
  262.   fi
  263.   # end of 'PATENTS'
  264. fi
  265. if test -f 'QUESTIONS' -a "${1}" != "-c" ; then 
  266.   echo shar: Will not clobber existing file \"'QUESTIONS'\"
  267. else
  268.   echo shar: Extracting \"'QUESTIONS'\" \(3130 characters\)
  269.   sed "s/^X//" >'QUESTIONS' <<'END_OF_FILE'
  270. X1. Aack! It won't compile! It doesn't work! What do I do?
  271. X2. Why do yabba and whap use so much memory?
  272. X3. Why does squeeze do better than yabba and whap on long files?
  273. X4. What does ``block size'' mean?
  274. X5. Why doesn't yabba take a filename argument?
  275. X6. When will there be a new version of yabbawhap?
  276. X
  277. X
  278. X1. Aack! It won't compile! It doesn't work! What do I do?
  279. X
  280. XRead through README, Makefile, and QUESTIONS. Make checkconf, run it,
  281. Xand read carefully through its output. Then try again. If you still have
  282. Xtrouble, send the author a note at brnstnd@nyu.edu.
  283. X
  284. X
  285. X2. Why do yabba and whap use so much memory?
  286. X
  287. XWith -UPTRS -DTYPE=short you will typically use half as much memory on a
  288. X32-bit machine. With -DHASHTYPE=short you will save some more memory for
  289. Xyabba and unyabba, though not for whap or unwhap. These changes usually
  290. Xcost a bit of speed. See Makefile for more details.
  291. X
  292. XYou can also change the block size by changing NODEMAX and MOD. These
  293. Xdon't really affect speed, but they do affect compression. With them you
  294. Xcan make yabba and whap use as much or as little memory as you like.
  295. X
  296. X
  297. X3. Why does squeeze do better than yabba and whap on long files?
  298. X
  299. XBy default, yabba and whap are compiled to use similar amounts of memory
  300. Xto compress. squeeze uses a lot more memory, so it can keep track of
  301. Xmore patterns in the input. If you compile yabba and whap with NODEMAX
  302. Xand MOD so high that they use as much memory, they'll do better than
  303. Xsqueeze.
  304. X
  305. XFor example, on a 97338-byte shell archive, yabba -m65533 compresses to
  306. X39266 bytes, and whap -m65533 compresses to 37358 bytes. yabba -m100000
  307. Xcompresses to 36673 bytes, and whap -m100000 compresses to 33566 bytes.
  308. X(In contrast, compress produces 43322 bytes, squeeze produces 33943
  309. Xbytes, and lharc produces 32455 bytes. A Huffman coder layered on top of
  310. Xyabba or whap would produce even better results.)
  311. X
  312. XThere are occasional files where squeeze performs better than yabba and
  313. Xwhap no matter how much memory you use, but never by much.
  314. X
  315. X
  316. X4. What does ``block size'' mean?
  317. X
  318. XThe number after -m represents a number of input characters. -m100000
  319. Xmeans that yabba (or whap) will try to find patterns in a stretch of
  320. Xinput up to 100000 characters long. NODEMAX and NODENUM are on the same
  321. Xscale. Here 100000 is the block size. In the above example with a
  322. X97338-byte file, any -m value above 97338 will produce the same results.
  323. X
  324. X(For compress, the natural block size is the number of patterns it is
  325. Xkeeping track of at once, not the number of input characters. With -b14,
  326. Xcompress will keep track of 2^14 or 16384 patterns at once. Typically
  327. X16384 patterns would stretch over 60000 input characters. -b16 is
  328. Xroughly equivalent to -m300000.)
  329. X
  330. X
  331. X5. Why doesn't yabba take a filename argument?
  332. X
  333. XWait for the -f option. Separate programs, fyabba and funyabba, will
  334. Xapply yabba and unyabba to files; fyabbadir and funyabbadir will work on
  335. Xdirectory hierarchies.
  336. X
  337. X
  338. X6. When will there be a new version of yabbawhap?
  339. X
  340. XI am actively working on the next release; I have targeted version 1.50
  341. Xwith most of the planned extensions for May 1. Send any suggestions or
  342. Xpatches to me at brnstnd@nyu.edu.
  343. END_OF_FILE
  344.   if test 3130 -ne `wc -c <'QUESTIONS'`; then
  345.     echo shar: \"'QUESTIONS'\" unpacked with wrong size!
  346.   fi
  347.   # end of 'QUESTIONS'
  348. fi
  349. if test -f 'bitout.c' -a "${1}" != "-c" ; then 
  350.   echo shar: Will not clobber existing file \"'bitout.c'\"
  351. else
  352.   echo shar: Extracting \"'bitout.c'\" \(2064 characters\)
  353.   sed "s/^X//" >'bitout.c' <<'END_OF_FILE'
  354. X/* Placed into the public domain by Daniel J. Bernstein. */
  355. X
  356. X#include <stdio.h>
  357. X#include "bitout.h"
  358. X
  359. Xstatic int twom1[9] = { 0,1,3,7,15,31,63,127,255 } ;
  360. X
  361. Xbitword bit_wbuf[BITBUFSIZE + 1];
  362. Xbitnum bit_bbuf[BITBUFSIZE + 1];
  363. Xint bit_bufsize = 0;
  364. X
  365. Xlong bit_numout = 0;
  366. X
  367. Xstatic int savecurbyte = 0;
  368. Xstatic bitnum savecurbb8 = 8;
  369. X
  370. Xint bit_printbuf()
  371. X{
  372. X register int curbyte = savecurbyte;
  373. X register bitnum curbb8 = savecurbb8;
  374. X register bitword curw;
  375. X register int i;
  376. X
  377. X /* XXX: should use registers & curbyte & so on better */
  378. X
  379. X for (i = 0;i < bit_bufsize;i++)
  380. X  {
  381. X   /* assumes bit_bbuf[i] <= 0 */
  382. X   curw = bit_wbuf[i];
  383. X   curbyte += ((curw & twom1[curbb8]) << (8 - curbb8));
  384. X#ifdef BRAINDAMAGED
  385. X   if (curbyte == 255)
  386. X     (void) putchar((char) curbyte);
  387. X   else
  388. X#endif
  389. X   if (putchar((char) curbyte) == EOF)
  390. X     return EOF;
  391. X   bit_numout++;
  392. X   curw >>= curbb8;
  393. X   curbb8 += bit_bbuf[i];
  394. X
  395. X   /* just in case bit_bbuf[i] < -7 */
  396. X   while (curbb8 <= 0)
  397. X    {
  398. X#ifdef BRAINDAMAGED
  399. X     if (curw & 255 == 255)
  400. X       (void) putchar((char) (curw & 255));
  401. X     else
  402. X#endif
  403. X     if (putchar((char) (curw & 255)) == EOF)
  404. X       return EOF;
  405. X     bit_numout++;
  406. X     curbb8 += 8;
  407. X     curw >>= 8;
  408. X    }
  409. X   curbyte = (int) curw; /* does not lose accuracy */
  410. X  }
  411. X savecurbyte = curbyte; /* ah, the joy of coroutines */
  412. X savecurbb8 = curbb8; /* better this way (double vars) for efficiency */
  413. X bit_bufsize = 0;
  414. X return 0;
  415. X}
  416. X
  417. Xint bit_flushbuf()
  418. X{
  419. X if (bit_printbuf() == EOF)
  420. X   return EOF;
  421. X if (savecurbb8 < 8)
  422. X  {
  423. X#ifdef BRAINDAMAGED
  424. X   if (savecurbyte == 255)
  425. X     (void) putchar((char) savecurbyte);
  426. X   else
  427. X#endif
  428. X   if (putchar((char) savecurbyte) == EOF)
  429. X     return EOF;
  430. X   bit_numout++;
  431. X  }
  432. X savecurbyte = 0;
  433. X savecurbb8 = 8;
  434. X return 0;
  435. X}
  436. X
  437. Xint bit_fillflush(x)
  438. Xint x;
  439. X{
  440. X if (bit_printbuf() == EOF)
  441. X   return EOF;
  442. X savecurbyte += (x << 8 - savecurbb8) & 255;
  443. X#ifdef BRAINDAMAGED
  444. X if (savecurbyte == 255)
  445. X   (void) putchar((char) savecurbyte);
  446. X else
  447. X#endif
  448. X if (putchar((char) savecurbyte) == EOF)
  449. X   return EOF;
  450. X bit_numout++;
  451. X savecurbyte = 0;
  452. X savecurbb8 = 8;
  453. X return 0;
  454. X}
  455. END_OF_FILE
  456.   if test 2064 -ne `wc -c <'bitout.c'`; then
  457.     echo shar: \"'bitout.c'\" unpacked with wrong size!
  458.   fi
  459.   # end of 'bitout.c'
  460. fi
  461. if test -f 'huptrie.h' -a "${1}" != "-c" ; then 
  462.   echo shar: Will not clobber existing file \"'huptrie.h'\"
  463. else
  464.   echo shar: Extracting \"'huptrie.h'\" \(7295 characters\)
  465.   sed "s/^X//" >'huptrie.h' <<'END_OF_FILE'
  466. X/* Placed into the public domain by Daniel J. Bernstein. */
  467. X
  468. X#ifndef HUPTRIE_H
  469. X#define HUPTRIE_H
  470. X
  471. X/* Ever seen an efficient data structure library? You're about to. */
  472. X
  473. X/* Yes, folks, I have some documentation for this; I'm just not sure */
  474. X/* that the library is ready for general release yet. If you're */
  475. X/* desperate for huptries in an application and *need* to use this */
  476. X/* library *now*, let me know. */
  477. X
  478. X/*#defines: PTRS, TYPE, HASHTYPE, ZEROFILLED, BZERO, MEMZERO, OPTCANT{1,2,5}.*/
  479. X/* HASHPTRS. */
  480. X
  481. X#ifndef HASHTYPE
  482. X#define HASHTYPE TYPE
  483. X#endif
  484. X
  485. Xtypedef unsigned TYPE pos;
  486. X
  487. X#ifdef PTRS
  488. Xtypedef struct nod { struct nod *p; struct nod *n; } *node;
  489. Xtypedef struct nod *next;
  490. Xtypedef int * /*XXX: irrelevant*/ parent;
  491. X#else
  492. Xtypedef pos node;
  493. Xtypedef node *next;
  494. Xtypedef node *parent;
  495. X#endif
  496. X
  497. X#ifdef HASHPTRS
  498. Xtypedef struct hod { node n; struct hod *h; } htt;
  499. Xtypedef struct hod *hash;
  500. X#define HASHP 255
  501. X#define HANO(h,sh) ((sh)->n)
  502. X#else
  503. Xtypedef node htt;
  504. Xtypedef unsigned HASHTYPE hash;
  505. X#define HASHP 0
  506. X#define HANO(h,sh) ((h)[sh])
  507. X#endif
  508. X
  509. Xtypedef htt *hashtable;
  510. Xtypedef pos ipos;
  511. X
  512. X/* A huptrie consists of:
  513. X   next n; parent p; hashtable h;
  514. X   ipos m; pos sm; pos l1; hash h1; 
  515. X*/
  516. X
  517. X#define TOPHASH 5381
  518. X
  519. X#ifdef HASHPTRS
  520. X#define hh(sh,sch,h1) (please do not use this yet, XXX)
  521. X#define hc(sh,c,h1) (sh[(unsigned char) c].h)
  522. X#else
  523. X#define hh(sh,sch,h1) (((sch) - (((sh) << 5) + (sh))) & (h1))
  524. X#define hc(sh,c,h1) ((((sh) << 5) + (sh) + ((hash) (unsigned char) (c))) & (h1))
  525. X#endif
  526. X
  527. X#ifdef PTRS
  528. X#define NEXT(ne,no) ((no)->n)
  529. X#define PARENT(pa,no) ((no)->p)
  530. X#define AVAIL(ne) ((ne)[0].n)
  531. X#define NODEBYN(ne,po) ((ne) + (po))
  532. X#else
  533. X#define NEXT(ne,no) ((ne)[no])
  534. X#define PARENT(pa,no) ((pa)[no])
  535. X#define AVAIL(ne) ((ne)[0])
  536. X#define NODEBYN(ne,po) (po)
  537. X#endif
  538. X
  539. X/* INIT, HUP_DELETE, DOWN are block statements. */
  540. X
  541. X/* n,p,h,m,sm are by address */
  542. X#ifdef PTRS
  543. X#define INIT(n,p,h,m,sm,l1,h1) \
  544. X{ (n) = malloc(sizeof(struct nod) * ((l1) + 1)); AVAIL(n) = 0; \
  545. X (h) = (hashtable) malloc(sizeof(htt) * ((h1) + HASHP + 1)); \
  546. X CLEARHASH(h,h1); FIRSTHASH(h,h1); (m) = (l1) + 1; (sm) = -1; }
  547. X#define STATICDECLARE(n,p,h,l1,h1) \
  548. X  struct nod (n)[(l1) + 1]; parent (p); htt (h)[(h1) + HASHP + 1];
  549. X#else
  550. X#define INIT(n,p,h,m,sm,l1,h1) \
  551. X{ (n) = (next) malloc(sizeof(node) * ((l1) + 1)); AVAIL(n) = 0; \
  552. X (p) = (parent) malloc(sizeof(node) * ((l1) + 1)); \
  553. X (h) = (hashtable) malloc(sizeof(htt) * ((h1) + HASHP + 1)); \
  554. X CLEARHASH(h,h1); FIRSTHASH(h,h1); (m) = (l1) + 1; (sm) = -1; }
  555. X#define STATICDECLARE(n,p,h,l1,h1) \
  556. X  node (n)[(l1) + 1]; node (p)[(l1) + 1]; htt (h)[(h1) + HASHP + 1];
  557. X#endif
  558. X
  559. X#define STATICINIT(n,p,h,m,sm,l1,h1) \
  560. X{ INITHASH(h,h1); AVAIL(n) = 0; (m) = (l1) + 1; (sm) = -1; }
  561. X/* FIRSTHASH(h,h1)  XXX*/
  562. X
  563. X#ifdef HASHPTRS
  564. X#define FIRSTHASH(h,h1) { hash ha; ha = (h) + ((h1) + HASHP + 1); \
  565. Xdo { --ha; ha->h = (h) + ((((ha - h) << 5) + (ha - h)) & (h1)); } \
  566. Xwhile (ha != (h)); }
  567. X#else
  568. X#define FIRSTHASH(h,h1) ;
  569. X#endif
  570. X
  571. X#ifdef ZEROFILLED
  572. X#define INITHASH(h,h1) ;
  573. X#else
  574. X#define INITHASH(h,h1) CLEARHASH(h,h1);
  575. X#endif
  576. X
  577. X#ifdef HASHPTRS
  578. X#define CLEARHASH(h,h1) { hash ha; ha = (h) + ((h1) + 1); do HANO(h,--ha) = 0; while (ha != (h)); }
  579. X/* XXX: if -UZEROFILLED, this is unnecessarily inefficient on the first CLEARHASH */
  580. X#else
  581. X#ifdef BZERO
  582. X#define CLEARHASH(h,h1) (void) bzero((char *) (h),sizeof(node) * ((h1) + 1));
  583. X#else
  584. X#ifdef MEMZERO
  585. X#define CLEARHASH(h,h1) (void) memset((char *) (h),0,sizeof(node) * ((h1) + 1));
  586. X#else
  587. X#define CLEARHASH(h,h1) { hash ha; ha = (h1) + 1; do HANO(h,--ha) = 0; while (ha); }
  588. X#endif
  589. X#endif
  590. X#endif
  591. X
  592. X
  593. X/* sm and newnode are by address */
  594. X#define ADDAVAIL(n,p,h,sm,sp,sch,newnode) \
  595. X( --(sm), (newnode = AVAIL(n)), (AVAIL(n) = NEXT(n,newnode)), \
  596. X (PARENT(p,newnode) = (sp)), \
  597. X (NEXT(n,newnode) = HANO(h,sch)), (HANO(h,sch) = (newnode)) )
  598. X
  599. X/* m, sm, newnode are by address */
  600. X#define WASTEMAX(n,p,h,m,sm,newnode) \
  601. X( (++(sm)), (newnode = NODEBYN(n,--(m))), (PARENT(p,newnode) = 0), \
  602. X (NEXT(n,newnode) = AVAIL(n)), (AVAIL(n) = (newnode)) )
  603. X
  604. X/* m and newnode are by address */
  605. X#define ADDMAX(n,p,h,m,sp,sch,newnode) \
  606. X( (newnode = NODEBYN(n,--(m))), (PARENT(p,newnode) = (sp)), \
  607. X (NEXT(n,newnode) = HANO(h,sch)), (HANO(h,sch) = (newnode)) )
  608. X
  609. X/* sm and noptr are by address */
  610. X#define HUP_DELETE(n,p,h,sm,sp,sh,noptr) \
  611. X{ (noptr) = &(HANO(h,sh)); while (*(noptr) != (sp)) (noptr) = &(NEXT(n,*(noptr))); \
  612. X *(noptr) = NEXT(n,sp); PARENT(p,sp) = 0; NEXT(n,sp) = AVAIL(n); \
  613. X AVAIL(n) = (sp); ++(sm); }
  614. X
  615. X/* no is by address, FOUND and NOTFOUND are formal */
  616. X/* XXX: Reorganize hash lists? */
  617. X#define DOWN2(n,p,h,sp,sch,no,FOUND,NOTFOUND) { \
  618. X if ((no) = HANO(h,sch)) { if (PARENT(p,no) != (sp)) { \
  619. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  620. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  621. X   do (no) = NEXT(n,no); while ((no) && (PARENT(p,no) != (sp))); \
  622. X   if (no) { FOUND } else { NOTFOUND } \
  623. X } else { FOUND } } else { NOTFOUND } \
  624. X } else { FOUND } } else { NOTFOUND } \
  625. X } else { FOUND } } else { NOTFOUND } \
  626. X}
  627. X
  628. X#define DOWN1(n,p,h,sp,sch,no,FOUND,NOTFOUND) { \
  629. X if ((no) = HANO(h,sch)) { if (PARENT(p,no) != (sp)) { \
  630. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  631. X   do (no) = NEXT(n,no); while ((no) && (PARENT(p,no) != (sp))); \
  632. X   if (no) { FOUND } else { NOTFOUND } \
  633. X } else { FOUND } } else { NOTFOUND } \
  634. X } else { FOUND } } else { NOTFOUND } \
  635. X}
  636. X
  637. X#define DOWN0(n,p,h,sp,sch,no,FOUND,NOTFOUND) { \
  638. X if ((no) = HANO(h,sch)) { if (PARENT(p,no) != (sp)) { \
  639. X   do (no) = NEXT(n,no); while ((no) && (PARENT(p,no) != (sp))); \
  640. X   if (no) { FOUND } else { NOTFOUND } \
  641. X } else { FOUND } } else { NOTFOUND } \
  642. X}
  643. X
  644. X#define DOWN5(n,p,h,sp,sch,no,FOUND,NOTFOUND) { \
  645. X if ((no) = HANO(h,sch)) { if (PARENT(p,no) != (sp)) { \
  646. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  647. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  648. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  649. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  650. X if ((no) = NEXT(n,no))  { if (PARENT(p,no) != (sp)) { \
  651. X   do (no) = NEXT(n,no); while ((no) && (PARENT(p,no) != (sp))); \
  652. X   if (no) { FOUND } else { NOTFOUND } \
  653. X } else { FOUND } } else { NOTFOUND } \
  654. X } else { FOUND } } else { NOTFOUND } \
  655. X } else { FOUND } } else { NOTFOUND } \
  656. X } else { FOUND } } else { NOTFOUND } \
  657. X } else { FOUND } } else { NOTFOUND } \
  658. X } else { FOUND } } else { NOTFOUND } \
  659. X}
  660. X
  661. X#ifdef OPTCANT1
  662. X#define DOWN DOWN0
  663. X#define DOWNI DOWN0
  664. X#else
  665. X#ifdef OPTCANT2
  666. X#define DOWN DOWN1
  667. X#define DOWNI DOWN1
  668. X#else
  669. X#ifdef OPTCANT5
  670. X#define DOWN DOWN2
  671. X#define DOWNI DOWN2
  672. X#else
  673. X#define DOWN DOWN5
  674. X#define DOWNI DOWN2
  675. X#endif
  676. X#endif
  677. X#endif
  678. X
  679. X#define hup_parent(p,no) PARENT(p,no)
  680. X#define setparent(p,scp,sp) (PARENT(p,scp) = (sp))
  681. X#ifdef HASHPTRS
  682. X#define tophash(h,h1) ((h) + (TOPHASH & (h1)))
  683. X#else
  684. X#define tophash(h,h1) (TOPHASH & (h1))
  685. X#endif
  686. X#define topnode(n,l1) (NODEBYN(n,(l1) + 1))
  687. X#define Hmax(m,l1) ((l1) - (m))
  688. X#define size(m,sm,l1) (((l1) - (m)) - (sm))
  689. X#define limitm1(l1) (l1)
  690. X#define ipos2pos(n,ip,l1) ((l1) - (ip))
  691. X#define pos2ipos(n,po,l1) ((l1) - (po))
  692. X
  693. X#ifdef PTRS
  694. X#define node2pos(n,no,l1) ((l1) - ((no) - (n)))
  695. X#define node2ipos(n,no,l1) ((no) - (n))
  696. X#else
  697. X#define node2pos(n,no,l1) ((l1) - (no))
  698. X#define node2ipos(n,no,l1) (no)
  699. X#endif
  700. X
  701. X#define ipos2node(n,ip,l1) (NODEBYN(n,ip))
  702. X#define pos2node(n,po,l1) (NODEBYN(n,(l1) - (po)))
  703. X
  704. X#endif
  705. END_OF_FILE
  706.   if test 7295 -ne `wc -c <'huptrie.h'`; then
  707.     echo shar: \"'huptrie.h'\" unpacked with wrong size!
  708.   fi
  709.   # end of 'huptrie.h'
  710. fi
  711. if test -f 'percent.c' -a "${1}" != "-c" ; then 
  712.   echo shar: Will not clobber existing file \"'percent.c'\"
  713. else
  714.   echo shar: Extracting \"'percent.c'\" \(2070 characters\)
  715.   sed "s/^X//" >'percent.c' <<'END_OF_FILE'
  716. X/* Placed into the public domain by Daniel J. Bernstein. */
  717. X
  718. X#include "percent.h"
  719. X
  720. X#define MAXULONG ((unsigned long) (-1))
  721. X
  722. X#define HENCE(x) ;
  723. X
  724. X#define ENOUGH(a) { long p = (a); if (q) { \
  725. Xif (q - 1 > limit / 100) return limit; \
  726. Xif ((q - 1) * 100 > limit - 100) return limit; \
  727. Xif (q * 100 > limit - p) return limit; \
  728. Xreturn (long) (p + q*100); } else if (p > limit) return limit; else return p; }
  729. X
  730. Xlong percent(a,b,limit)
  731. Xunsigned long a;
  732. Xunsigned long b;
  733. Xlong limit;
  734. X{
  735. X unsigned long q;
  736. X unsigned long s;
  737. X unsigned long t;
  738. X
  739. X q = 0;
  740. X
  741. X if (b == 0)
  742. X   ENOUGH(100)
  743. X HENCE(b > 0);
  744. X
  745. X if (b < MAXULONG - 200)
  746. X   if (a < (MAXULONG / 200) - (b / 200) - 1) /* cannot go below 0 */
  747. X     ENOUGH((100 * a + (b / 2)) / b) /* cannot overflow */
  748. X HENCE(a + (b / 200) + 1 >= MAXULONG / 200);
  749. X /* How often will a and b be more than 21 million on a 32-bit machine? */
  750. X
  751. X if (a < b / 200)
  752. X   ENOUGH(0)
  753. X HENCE(a >= b / 200);
  754. X HENCE(a + a + 1 >= MAXULONG / 200);
  755. X
  756. X if (a >= b)
  757. X  {
  758. X   q = a / b;
  759. X   HENCE(a - q * b < b);
  760. X   a -= q * b;
  761. X  }
  762. X HENCE(a < b);
  763. X
  764. X t = 0; s = a;
  765. X /* now s is a mod b, t is floor(a/b) */
  766. X if (s >= b - a) { t += 1; s -= b - a; } else { s += a; }
  767. X /* now s is 2a mod b, t is floor(2a/b) */
  768. X if (s >= b - a) { t += 1; s -= b - a; } else { s += a; }
  769. X /* now s is 3a mod b, t is floor(3a/b) */
  770. X if (s >= b - s) { t += t + 1; s -= b - s; } else { t += t; s += s; }
  771. X /* now s is 6a mod b, t is floor(6a/b) */
  772. X if (s >= b - s) { t += t + 1; s -= b - s; } else { t += t; s += s; }
  773. X /* now s is 12a mod b, t is floor(12a/b) */
  774. X if (s >= b - s) { t += t + 1; s -= b - s; } else { t += t; s += s; }
  775. X /* now s is 24a mod b, t is floor(24a/b) */
  776. X if (s >= b - a) { t += 1; s -= b - a; } else { s += a; }
  777. X /* now s is 25a mod b, t is floor(25a/b) */
  778. X if (s >= b - s) { t += t + 1; s -= b - s; } else { t += t; s += s; }
  779. X /* now s is 50a mod b, t is floor(50a/b) */
  780. X if (s >= b - s) { t += t + 1; s -= b - s; } else { t += t; s += s; }
  781. X /* now s is 100a mod b, t is floor(100a/b) */
  782. X if (s >= b - (b/2)) { t += 1; s -= b - (b/2); } else { s += (b/2); }
  783. X
  784. X ENOUGH(t)
  785. X /* whew. */
  786. X}
  787. END_OF_FILE
  788.   if test 2070 -ne `wc -c <'percent.c'`; then
  789.     echo shar: \"'percent.c'\" unpacked with wrong size!
  790.   fi
  791.   # end of 'percent.c'
  792. fi
  793. if test -f 'sysconf' -a "${1}" != "-c" ; then 
  794.   echo shar: Will not clobber existing file \"'sysconf'\"
  795. else
  796.   echo shar: Extracting \"'sysconf'\" \(4852 characters\)
  797.   sed "s/^X//" >'sysconf' <<'END_OF_FILE'
  798. X#!/bin/sh
  799. X# Public domain.
  800. X
  801. X# Configure, eat your heart out.
  802. X
  803. X# make sure we're using sh (stolen from Configure)
  804. XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
  805. Xexport PATH || (echo "Aargh! This isn't sh. Desperation time. I will now feed myself to sh..."; exec sh $0; sh $0; kill $$)
  806. Xecho "We're using sh. Good."
  807. X
  808. X# make sure cmp works
  809. Xif cmp README README >/dev/null 2>&1
  810. Xthen if cmp README FORMLETTER >/dev/null 2>&1
  811. X     then echo 'Aargh! cmp returns a zero exit code for different files. This is hopeless.'
  812. X      exit 1
  813. X     else echo 'You have a normal cmp. Good.'
  814. X     fi
  815. Xelse echo 'Aargh! cmp returns a nonzero exit code for the same file. This is hopeless.'
  816. X     exit 1
  817. Xfi
  818. X
  819. X# test for bzero()
  820. Xcat > .bzero.$$.c << 'YOW'
  821. Xextern bzero(); main() { char c = 1; bzero(&c,1); printf("%d\n",c); }
  822. XYOW
  823. Xif cc -o .bzero.$$ .bzero.$$.c >/dev/null 2>&1
  824. Xthen ./.bzero.$$ > .bzero.$$.out
  825. X     echo 0 > .zero.$$.out
  826. X     if cmp .zero.$$.out .bzero.$$.out >/dev/null 2>&1
  827. X     then echo 'You have bzero(). Enabling it...'
  828. X      sed '2s/$/ -DBZERO/' < Makefile | sed '2s/-UBZERO /-DBZERO /g' | sed '2s/-DBZERO\(.*\) -DBZERO$/-DBZERO\1/' > Makefile.new
  829. X      mv Makefile.new Makefile
  830. X     else echo 'You seem to have bzero(), but it doesn'\''t work. Disabling it...'
  831. X      sed '2s/$/ -UBZERO/' < Makefile | sed '2s/-DBZERO /-UBZERO /g' | sed '2s/-UBZERO\(.*\) -UBZERO$/-UBZERO\1/' > Makefile.new
  832. X      mv Makefile.new Makefile
  833. X     fi
  834. Xelse echo 'You do not have bzero(). Disabling it...'
  835. X     sed '2s/$/ -UBZERO/' < Makefile | sed '2s/-DBZERO /-UBZERO /g' | sed '2s/-UBZERO\(.*\) -UBZERO$/-UBZERO\1/' > Makefile.new
  836. X     mv Makefile.new Makefile
  837. Xfi
  838. Xrm -f .bzero.$$ .bzero.$$.out .bzero.$$.c .zero.$$.out
  839. X
  840. X# test for memset()
  841. Xcat > .mmset.$$.c << 'YOW'
  842. Xextern memset(); main() { char c = 1; memset(&c,0,1); printf("%d\n",c); }
  843. XYOW
  844. Xif cc -o .mmset.$$ .mmset.$$.c >/dev/null 2>&1
  845. Xthen ./.mmset.$$ > .mmset.$$.out
  846. X     echo 0 > .zero.$$.out
  847. X     if cmp .zero.$$.out .mmset.$$.out >/dev/null 2>&1
  848. X     then echo 'You have memset(). Enabling it...'
  849. X      sed '2s/$/ -DMEMZERO/' < Makefile | sed '2s/-UMEMZERO /-DMEMZERO /g' | sed '2s/-DMEMZERO\(.*\) -DMEMZERO$/-DMEMZERO\1/' > Makefile.new
  850. X      mv Makefile.new Makefile
  851. X     else echo 'You seem to have memset(), but it doesn'\''t work. Disabling it...'
  852. X      sed '2s/$/ -UMEMZERO/' < Makefile | sed '2s/-DMEMZERO /-UMEMZERO /g' | sed '2s/-UMEMZERO\(.*\) -UMEMZERO$/-UMEMZERO\1/' > Makefile.new
  853. X      mv Makefile.new Makefile
  854. X     fi
  855. Xelse echo 'You do not have memset(). Disabling it...'
  856. X     sed '2s/$/ -UMEMZERO/' < Makefile | sed '2s/-DMEMZERO /-UMEMZERO /g' | sed '2s/-UMEMZERO\(.*\) -UMEMZERO$/-UMEMZERO\1/' > Makefile.new
  857. X     mv Makefile.new Makefile
  858. Xfi
  859. Xrm -f .mmset.$$ .mmset.$$.out .mmset.$$.c .zero.$$.out
  860. X
  861. X# test for putchar not sign-extending correctly
  862. Xcat > .bozo.$$.c << 'YOW'
  863. X#include <stdio.h>
  864. Xmain() { int i=255; putchar(25); exit(putchar((char)i) != EOF); }
  865. XYOW
  866. Xif cc -o .bozo.$$ .bozo.$$.c >/dev/null 2>&1
  867. Xthen if ./.bozo.$$ >/dev/null
  868. X     then echo 'You have the putchar((char) 255) == EOF bug.'
  869. X      echo 'Let me put -DBRAINDAMAGED into the Makefile for you...'
  870. X      sed '2s/$/ -DBRAINDAMAGED/' < Makefile | sed '2s/-UBRAINDAMAGED /-DBRAINDAMAGED /g' | sed '2s/-DBRAINDAMAGED\(.*\) -DBRAINDAMAGED$/-DBRAINDAMAGED\1/' > Makefile.new
  871. X      mv Makefile.new Makefile
  872. X      echo 'You *must* make sure to leave this defined.'
  873. X     else echo 'You do not have the putchar((char) 255) == EOF bug.'
  874. X      echo 'Making sure -DBRAINDAMAGED is not in the Makefile...'
  875. X      sed '2s/$/ -UBRAINDAMAGED/' < Makefile | sed '2s/-DBRAINDAMAGED /-UBRAINDAMAGED /g' | sed '2s/-UBRAINDAMAGED\(.*\) -UBRAINDAMAGED$/-UBRAINDAMAGED\1/' > Makefile.new
  876. X      mv Makefile.new Makefile
  877. X     fi
  878. Xelse echo 'Weird, cannot compile normal stdio program.'
  879. X     echo 'Making sure -DBRAINDAMAGED is not in the Makefile...'
  880. X     sed '2s/$/ -UBRAINDAMAGED/' < Makefile | sed '2s/-DBRAINDAMAGED /-UBRAINDAMAGED /g' | sed '2s/-UBRAINDAMAGED\(.*\) -UBRAINDAMAGED$/-UBRAINDAMAGED\1/' > Makefile.new
  881. X     mv Makefile.new Makefile
  882. Xfi
  883. Xrm -f .bozo.$$ .bozo.$$.out .bozo.$$.c .zero.$$.out
  884. X
  885. X# set ZEROFILLED
  886. Xecho "Since you're running this script, I assume that you're on a UNIX machine,"
  887. Xecho "and static arrays are zero-filled by default. Enabling -DZEROFILLED..."
  888. Xsed '2s/$/ -DZEROFILLED/' < Makefile | sed '2s/-UZEROFILLED /-DZEROFILLED /g' | sed '2s/-DZEROFILLED\(.*\) -DZEROFILLED$/-DZEROFILLED\1/' > Makefile.new
  889. Xmv Makefile.new Makefile
  890. X
  891. Xecho ' '
  892. Xecho 'Okay, now you should make checkconf and run it.'
  893. Xecho 'If you would like me to do this for you, press return.'
  894. Xecho 'Otherwise type no and press return, or just interrupt this script.'
  895. Xread foo
  896. Xcase x"$foo"y in
  897. Xxy) echo 'make checkconf'
  898. X    if make checkconf
  899. X    then echo './checkconf'
  900. X     ./checkconf
  901. X    else echo 'Oops, make checkconf failed. I give up: you figure it out.'
  902. X    fi
  903. X    ;;
  904. Xesac
  905. X
  906. Xexit 0
  907. END_OF_FILE
  908.   if test 4852 -ne `wc -c <'sysconf'`; then
  909.     echo shar: \"'sysconf'\" unpacked with wrong size!
  910.   fi
  911.   chmod +x 'sysconf'
  912.   # end of 'sysconf'
  913. fi
  914. if test -f 'texts.c' -a "${1}" != "-c" ; then 
  915.   echo shar: Will not clobber existing file \"'texts.c'\"
  916. else
  917.   echo shar: Extracting \"'texts.c'\" \(6240 characters\)
  918.   sed "s/^X//" >'texts.c' <<'END_OF_FILE'
  919. X/* Placed into the public domain by Daniel J. Bernstein. */
  920. X
  921. X/* If you change the code, you should (1) add your name to sqauthor[] */
  922. X/* and/or unsqauthor[]; (2) add a patch label to the version numbers */
  923. X/* in sqversion[], sqcopyright[], unsqversion[], and unsqcopyright[]; */
  924. X/* (3) change squsage[], sqhelp[], unsqusage[], and unsqhelp[] if you */
  925. X/* changed the interface. The patch label should be a slash, your */
  926. X/* initials, and the date the patch was released---e.g., version */
  927. X/* 0.98 might become 0.98/JS032291 and then 0.98/JS032291/SS040591. */
  928. X/* If you let me know about your changes, I'll try to integrate them */
  929. X/* into the next release. */
  930. X
  931. X#include "texts.h"
  932. X
  933. Xchar *sqauthor[] = {
  934. X"yabbawhap was written by Daniel J. Bernstein." ,
  935. X"Internet address: brnstnd@nyu.edu." ,
  936. X0 } ;
  937. X
  938. Xchar *sqversion[] = {
  939. X"yabbawhap version 1.00, March 19, 1991." ,
  940. X"Placed into the public domain by Daniel J. Bernstein." ,
  941. X0 } ;
  942. X
  943. Xchar *sqcopyright[] = {
  944. X"yabbawhap version 1.00, March 19, 1991." ,
  945. X"Placed into the public domain by Daniel J. Bernstein." ,
  946. X"" ,
  947. X"There is no copyright on this code. You may use it in any way you want." ,
  948. X"" ,
  949. X"If you have questions about this program or about this notice, or if you" ,
  950. X"have a patch that you don't mind sharing, please contact me on the Internet" ,
  951. X"at brnstnd@nyu.edu." ,
  952. X0 } ;
  953. X
  954. Xchar *sqwarranty[] = {
  955. X"Daniel J. Bernstein disclaims all warranties to the extent permitted" ,
  956. X"by applicable law. He is not and shall not be liable for any damages" ,
  957. X"arising from the use of this program. This disclaimer shall be governed" ,
  958. X"by the laws of the state of New York." ,
  959. X"" ,
  960. X"In other words, use this program at your own risk." ,
  961. X"" ,
  962. X"If you have questions about this program or about this disclaimer of" ,
  963. X"warranty, please feel free to contact me at brnstnd@nyu.edu on the" ,
  964. X"Internet." ,
  965. X0 } ;
  966. X
  967. Xchar *squsage[] = {
  968. X#ifdef WHAP
  969. X"Usage: whap [ -mmem ] [ -znum ] [ -Zfuzz ] [ -qQv^rRACHUVW ]" ,
  970. X"Help:  whap -H" ,
  971. X#else
  972. X"Usage: yabba [ -mmem ] [ -znum ] [ -Zfuzz ] [ -qQv^rRACHUVW ]" ,
  973. X"Help:  yabba -H" ,
  974. X#endif
  975. X0 } ;
  976. X
  977. Xchar *sqhelp[] = {
  978. X#ifdef WHAP
  979. X"whap compresses its input using AP coding. It writes the result to its output." ,
  980. X"whap -ACHUVW: print authorship notice, copyright notice, this notice," ,
  981. X"              short usage summary, version number, disclaimer of warranty" ,
  982. X"whap [ -mmem ] [ -znum ] [ -Zfuzz ] [ -qQv^rR ]: compress" ,
  983. X#else
  984. X"yabba compresses its input using Y coding. It writes the result to its output." ,
  985. X"yabba -ACHUVW: print authorship notice, copyright notice, this notice," ,
  986. X"               short usage summary, version number, disclaimer of warranty" ,
  987. X"yabba [ -mmem ] [ -znum ] [ -Zfuzz ] [ -qQv^rR ]: compress" ,
  988. X#endif
  989. X"-mmem: set block size to mem (default: factory 65533 chars, here %d)" ,
  990. X"-r: randomize output to prepare for encryption; also omit header" ,
  991. X"-R: don't randomize (default); use header" ,
  992. X"-q: quiet (nothing on standard error)" ,
  993. X"-Q: normal level of verbosity" ,
  994. X"-v: verbose: like  In: 312163 chars  Out: 106253 chars  Whapped to: 34%%" ,
  995. X"-znum: set blocking test length (factory default 8192)" ,
  996. X"-Zfuzz: set blocking fuzz (factory default 30)" ,
  997. X"-^: like -v, but print percent saved rather than percent remaining" ,
  998. X"" ,
  999. X#ifdef WHAP
  1000. X"unwhap must be given the same settings of -m and -r/-R." ,
  1001. X#else
  1002. X"unyabba must be given the same settings of -m and -r/-R." ,
  1003. X#endif
  1004. X"" ,
  1005. X"If you have questions about or suggestions for yabbawhap, please feel free" ,
  1006. X"to contact the author, Daniel J. Bernstein, at brnstnd@nyu.edu on the" ,
  1007. X"Internet." ,
  1008. X0 } ;
  1009. X
  1010. Xchar *unsqauthor[] = {
  1011. X"yabbawhap was written by Daniel J. Bernstein." ,
  1012. X"Internet address: brnstnd@nyu.edu." ,
  1013. X0 } ;
  1014. X
  1015. Xchar *unsqversion[] = {
  1016. X"yabbawhap version 1.00, March 19, 1991." ,
  1017. X"Placed into the public domain by Daniel J. Bernstein." ,
  1018. X0 } ;
  1019. X
  1020. Xchar *unsqcopyright[] = {
  1021. X"yabbawhap version 1.00, March 19, 1991." ,
  1022. X"Placed into the public domain by Daniel J. Bernstein." ,
  1023. X"" ,
  1024. X"There is no copyright on this code. You may use it in any way you want." ,
  1025. X"" ,
  1026. X"If you have questions about this program or about this notice, or if you" ,
  1027. X"have a patch that you don't mind sharing, please contact me on the Internet" ,
  1028. X"at brnstnd@nyu.edu." ,
  1029. X0 } ;
  1030. X
  1031. Xchar *unsqwarranty[] = {
  1032. X"Daniel J. Bernstein disclaims all warranties to the extent permitted" ,
  1033. X"by applicable law. He is not and shall not be liable for any damages" ,
  1034. X"arising from the use of this program. This disclaimer shall be governed" ,
  1035. X"by the laws of the state of New York." ,
  1036. X"" ,
  1037. X"In other words, use this program at your own risk." ,
  1038. X"" ,
  1039. X"If you have questions about this program or about this disclaimer of" ,
  1040. X"warranty, please feel free to contact me at brnstnd@nyu.edu on the" ,
  1041. X"Internet." ,
  1042. X0 } ;
  1043. X
  1044. Xchar *unsqusage[] = {
  1045. X#ifdef WHAP
  1046. X"Usage: unwhap [ -mmem ] [ -qQvrRACHUVW ]" ,
  1047. X"Help:  unwhap -H" ,
  1048. X#else
  1049. X"Usage: unyabba [ -mmem ] [ -qQvrRACHUVW ]" ,
  1050. X"Help:  unyabba -H" ,
  1051. X#endif
  1052. X0 } ;
  1053. X
  1054. Xchar *unsqhelp[] = {
  1055. X#ifdef WHAP
  1056. X"unwhap uncompresses its input, which must have come from whap, to its output." ,
  1057. X"unwhap -ACHUVW: print authorship notice, copyright notice, this notice," ,
  1058. X"                short usage summary, version number, disclaimer of warranty" ,
  1059. X"unwhap [ -mmem ] [ -qQvrR ]: uncompress" ,
  1060. X#else
  1061. X"unyabba uncompresses its input, which must have come from yabba, to its output." ,
  1062. X"unyabba -ACHUVW: print authorship notice, copyright notice, this notice," ,
  1063. X"                 short usage summary, version number, disclaimer of warranty" ,
  1064. X"unyabba [ -mmem ] [ -qQvrR ]: uncompress" ,
  1065. X#endif
  1066. X"-mmem: set block size to mem (default: factory 65533 chars, here %d)" ,
  1067. X"-r: accept randomized input without a header" ,
  1068. X"-R: complain about randomized input; check for header" ,
  1069. X"-q: quiet (nothing on standard error)" ,
  1070. X"-Q: normal level of verbosity" ,
  1071. X"-v: verbose: like  In: 106253 chars  Out: 312163 chars  Whapped from: 34%%" ,
  1072. X"" ,
  1073. X#ifdef WHAP
  1074. X"The whap that wrote the input must have the same settings of -m and -r/-R." ,
  1075. X#else
  1076. X"The yabba that wrote the input must have the same settings of -m and -r/-R." ,
  1077. X#endif
  1078. X"" ,
  1079. X"If you have questions about or suggestions for yabbawhap, please feel free" ,
  1080. X"to contact the author, Daniel J. Bernstein, at brnstnd@nyu.edu on the" ,
  1081. X"Internet." ,
  1082. X0 } ;
  1083. END_OF_FILE
  1084.   if test 6240 -ne `wc -c <'texts.c'`; then
  1085.     echo shar: \"'texts.c'\" unpacked with wrong size!
  1086.   fi
  1087.   # end of 'texts.c'
  1088. fi
  1089. if test -f 'unwhap.c' -a "${1}" != "-c" ; then 
  1090.   echo shar: Will not clobber existing file \"'unwhap.c'\"
  1091. else
  1092.   echo shar: Extracting \"'unwhap.c'\" \(6299 characters\)
  1093.   sed "s/^X//" >'unwhap.c' <<'END_OF_FILE'
  1094. X/* Placed into the public domain by Daniel J. Bernstein. */
  1095. X
  1096. Xstatic char whapwarning[] = "\
  1097. XWARNING! If you use AP coding except for instruction and amusement,\n\
  1098. Xyou may be infringing upon a patent.\n\
  1099. X";
  1100. X
  1101. X#include <stdio.h>
  1102. Xextern long atol();
  1103. Xextern int getopt();
  1104. Xextern char *optarg;
  1105. Xextern int optind;
  1106. X#include "percent.h"
  1107. X#include "texts.h"
  1108. X
  1109. Xstatic char progname[] = "unwhap";
  1110. Xstatic char progged[] = "Unwhapped";
  1111. X
  1112. X#ifndef TYPE
  1113. X#define TYPE short
  1114. X#endif
  1115. X
  1116. Xtypedef TYPE bitnum;
  1117. Xtypedef unsigned TYPE bitword;
  1118. X
  1119. Xint twom1[9] = { 0,1,3,7,15,31,63,127,255 } ;
  1120. X
  1121. X#ifndef NODEMAX
  1122. X#define NODEMAX (65533)
  1123. X#endif
  1124. X#ifndef NODENUM
  1125. X#define NODENUM NODEMAX
  1126. X#endif
  1127. Xstatic char outarray[NODEMAX]; /* first 256 spots unused, boo hoo hoo */
  1128. Xstatic bitword outstart[NODEMAX]; /* first 256 spots unused, boo hoo hoo */
  1129. X
  1130. X#define MAXPLUS max++; oamax++; osmax++; \
  1131. Xif (max == nextbits) { bits++; nextbits <<= 1; }
  1132. X
  1133. Xstatic unsigned long savein;
  1134. Xstatic unsigned long saveout;
  1135. Xstatic int flagverbose = 1;
  1136. Xstatic int flagrandom = 0;
  1137. X
  1138. Xvoid goaheadandbeverbose()
  1139. X{
  1140. X long per = percent(savein,saveout,10000L);
  1141. X
  1142. X if (per == 10000L) /* absolutely ridiculous */
  1143. X   fprintf(stderr,"In: %ld chars  Out: %ld chars  %s from: >9999%%\n",
  1144. X           savein,saveout,progged);
  1145. X else
  1146. X   fprintf(stderr,"In: %ld chars  Out: %ld chars  %s from: %ld%%\n",
  1147. X       savein,saveout,progged,per);
  1148. X}
  1149. X
  1150. Xvoid fatalinfo(x,s)
  1151. Xint x;
  1152. Xchar **s;
  1153. X{
  1154. X if (flagverbose) while (*s)
  1155. X  {
  1156. X   fprintf(stderr,*(s++),NODENUM);
  1157. X   putc('\n',stderr);
  1158. X  }
  1159. X (void) exit(x);
  1160. X}
  1161. X
  1162. X#define PUTERR { if (flagverbose) fprintf(stderr,"%s: fatal: output error\n",progname); \
  1163. Xsavein = in; saveout = out; \
  1164. Xif (flagverbose >= 2) goaheadandbeverbose(); (void) exit(2); }
  1165. X
  1166. Xmain(argc,argv)
  1167. Xint argc;
  1168. Xchar *argv[];
  1169. X{
  1170. X register bitword i;
  1171. X register char *j;
  1172. X register bitword outb;
  1173. X register bitword max;
  1174. X register bitword nextbits;
  1175. X register bitnum bits;
  1176. X register bitword curw = 0;
  1177. X register bitnum curbb = 0;
  1178. X register int ch;
  1179. X register char *oamax;
  1180. X register bitword *osmax;
  1181. X register char *oai;
  1182. X register bitword min = NODENUM - 1; /* maximum decompressor size - 1 */
  1183. X register unsigned long in = 0;
  1184. X register unsigned long out = 0;
  1185. X
  1186. X  {
  1187. X   int opt;
  1188. X   bitword i;
  1189. X
  1190. X   while ((opt = getopt(argc,argv,"m:vqQrRACHUVW")) != EOF)
  1191. X     switch(opt)
  1192. X      {
  1193. X       case '?': fatalinfo(1,unsqusage);
  1194. X       case 'm': i = atol(optarg);
  1195. X         if ((i < 512) || (i > NODEMAX))
  1196. X          {
  1197. X           if (flagverbose) fprintf(stderr,
  1198. X              "%s: fatal: mem size out of range: must be between 512 and %ld\n",
  1199. X              progname,(long) NODEMAX);
  1200. X           (void) exit(1);
  1201. X          }
  1202. X         min = i - 1;
  1203. X         break;
  1204. X       case 'v': flagverbose = 2; break;
  1205. X       case 'q': flagverbose = 0; break;
  1206. X       case 'Q': flagverbose = 1; break;
  1207. X       case 'r': flagrandom = 1; break;
  1208. X       case 'R': flagrandom = 0; break;
  1209. X       case 'A': fatalinfo(1,unsqauthor); break;
  1210. X       case 'C': fatalinfo(1,unsqcopyright); break;
  1211. X       case 'H': fatalinfo(1,unsqhelp); break;
  1212. X       case 'U': fatalinfo(1,unsqusage); break;
  1213. X       case 'V': fatalinfo(1,unsqversion); break;
  1214. X       case 'W': fatalinfo(1,unsqwarranty); break;
  1215. X      }
  1216. X   argv += optind;
  1217. X   argc -= optind;
  1218. X  }
  1219. X
  1220. X if (flagverbose)
  1221. X   fprintf(stderr,whapwarning);
  1222. X
  1223. X if (!flagrandom)
  1224. X  {
  1225. X   bitword i = 0;
  1226. X   int r;
  1227. X
  1228. X   if ((getchar() != 23)
  1229. X     ||(getchar() != 8)
  1230. X     ||(getchar() != 1)
  1231. X     ||(getchar() != 16)
  1232. X     ||((r = getchar()) == EOF))
  1233. X    {
  1234. X     if (flagverbose) fprintf(stderr,"%s: fatal: input not in right format\n",progname);
  1235. X     (void) exit(3);
  1236. X    }
  1237. X   in += 5;
  1238. X   while (r)
  1239. X    {
  1240. X     if (((ch = getchar()) == EOF) || (ch < 48) || (ch > 57))
  1241. X      {
  1242. X       if (flagverbose) fprintf(stderr,"%s: fatal: input not in right format\n",progname);
  1243. X       (void) exit(3);
  1244. X      }
  1245. X     ++in;
  1246. X     i = i * 10 + (ch - 48);
  1247. X     --r;
  1248. X    }
  1249. X   if (i != min + 1)
  1250. X    {
  1251. X     if (flagverbose) fprintf(stderr,"%s: fatal: input has -m %ld, I have -m %ld\n"
  1252. X         ,progname,(long) i,(long) (min + 1));
  1253. X     (void) exit(4);
  1254. X    }
  1255. X  }
  1256. X
  1257. X#define MINIT max = 256; oamax = outarray + 256; osmax = outstart + 256; \
  1258. Xoutb = 256; nextbits = 256; bits = 8; \
  1259. Xwhile (max >= nextbits) { bits++; nextbits <<= 1; }
  1260. X/* of course, max = 255 plus one for table clearing */
  1261. X
  1262. X MINIT
  1263. X
  1264. X for (;;)
  1265. X  {
  1266. X   /* assumes bits >= 8 */
  1267. X   while (curbb + 8 < bits) /* could be an if, when bits is < 16 */
  1268. X     if ((ch = getchar()) != EOF)
  1269. X      {
  1270. X       curw += ch << curbb;
  1271. X       curbb += 8;
  1272. X       ++in; /* XXX: check for overflow */
  1273. X      }
  1274. X     else
  1275. X      {
  1276. X       savein = in; saveout = out;
  1277. X       if (flagverbose >= 2)
  1278. X     goaheadandbeverbose();
  1279. X       (void) exit(0);
  1280. X      }
  1281. X   if ((ch = getchar()) == EOF)
  1282. X    {
  1283. X     savein = in; saveout = out;
  1284. X     if (flagverbose >= 2)
  1285. X       goaheadandbeverbose();
  1286. X     (void) exit(0);
  1287. X    }
  1288. X   i = curw + ((ch & twom1[bits - curbb]) << curbb);
  1289. X   curw = ch >> (bits - curbb);
  1290. X   curbb = 8 - (bits - curbb);
  1291. X   ++in; /* XXX: check for overflow */
  1292. X
  1293. X   /* XXX: flagpedantic to control whether we make this test? */
  1294. X   if (i > max)
  1295. X     if (flagrandom)
  1296. X       i -= max + 1;
  1297. X     else
  1298. X      {
  1299. X       if (flagverbose) fprintf(stderr,"%s: fatal: input corrupt at byte %ld\n",progname,in);
  1300. X       (void) exit(5);
  1301. X      }
  1302. X
  1303. X   if (i < 257) /* 256 is special */
  1304. X     if (i != 256)
  1305. X      {
  1306. X       if (max != min)
  1307. X    {
  1308. X         MAXPLUS
  1309. X     *osmax = outb;
  1310. X     *oamax = i;
  1311. X         outb = max;
  1312. X    }
  1313. X#ifdef BRAINDAMAGED
  1314. X       if (i == 255)
  1315. X     putchar((char) i);
  1316. X       else
  1317. X#endif
  1318. X       if (putchar((char) i) == EOF)
  1319. X         PUTERR
  1320. X       ++out; /* XXX: check for overflow */
  1321. X      }
  1322. X     else
  1323. X      {
  1324. X       /* here's where blocking stuff should go */
  1325. X       MINIT
  1326. X       /* wow, that was easy */
  1327. X      }
  1328. X   else
  1329. X    {
  1330. X     oai = outarray + i;
  1331. X     j = outarray + outstart[i] - 1;
  1332. X     while ((j != oai) && (max != min))
  1333. X      {
  1334. X       MAXPLUS
  1335. X       *oamax = *++j;
  1336. X#ifdef BRAINDAMAGED
  1337. X       if (*oamax == (char) 255)
  1338. X     putchar(*oamax);
  1339. X       else
  1340. X#endif
  1341. X       if (putchar(*oamax) == EOF)
  1342. X     PUTERR
  1343. X       ++out; /* XXX: check for overflow */
  1344. X       *osmax = outb;
  1345. X      }
  1346. X     while (j != oai)
  1347. X      {
  1348. X       ++j;
  1349. X#ifdef BRAINDAMAGED
  1350. X       if (*j == (char) 255)
  1351. X     putchar(*j);
  1352. X       else
  1353. X#endif
  1354. X       if (putchar(*j) == EOF)
  1355. X     PUTERR
  1356. X       ++out; /* XXX: check for overflow */
  1357. X      }
  1358. X     outb = max - (i - outstart[i]);
  1359. X    }
  1360. X#ifdef notdef
  1361. X/*XXX: -d code */
  1362. X#endif
  1363. X  }
  1364. X}
  1365. END_OF_FILE
  1366.   if test 6299 -ne `wc -c <'unwhap.c'`; then
  1367.     echo shar: \"'unwhap.c'\" unpacked with wrong size!
  1368.   fi
  1369.   # end of 'unwhap.c'
  1370. fi
  1371. if test -f 'unyabba.1' -a "${1}" != "-c" ; then 
  1372.   echo shar: Will not clobber existing file \"'unyabba.1'\"
  1373. else
  1374.   echo shar: Extracting \"'unyabba.1'\" \(2906 characters\)
  1375.   sed "s/^X//" >'unyabba.1' <<'END_OF_FILE'
  1376. X.TH unyabba 1
  1377. X.SH NAME
  1378. Xunyabba \- decompress data compressed with Y coding
  1379. X
  1380. Xunwhap \- decompress data compressed with AP coding
  1381. X.SH SYNTAX
  1382. Xunyabba
  1383. X[
  1384. X\fB\-m\fImem
  1385. X] [
  1386. X\fB\-qQvrR\fI
  1387. X] [
  1388. X\fB\-ACHUVW\fI
  1389. X]
  1390. X
  1391. X\fBunwhap
  1392. X[
  1393. X\fB\-m\fImem
  1394. X] [
  1395. X\fB\-qQvrR\fI
  1396. X] [
  1397. X\fB\-ACHUVW\fI
  1398. X]
  1399. X.SH DESCRIPTION
  1400. X.I unyabba
  1401. Xdecompresses its standard input,
  1402. Xwhich must have come from
  1403. X.I yabba,
  1404. Xand writes the result to its standard output.
  1405. X
  1406. X.I unwhap
  1407. Xis like
  1408. X.I unyabba,
  1409. Xbut works with files from
  1410. X.I whap.
  1411. XWarning: If you use
  1412. X.I unwhap
  1413. Xexcept for experimental use,
  1414. Xyou may be infringing upon a patent.
  1415. X
  1416. XOptions
  1417. X.B ACHUVW
  1418. Xprint the authorship notice,
  1419. Xcopyright notice,
  1420. Xhelp notice,
  1421. Xshort usage summary,
  1422. Xversion number,
  1423. Xand warranty information respectively.
  1424. X
  1425. X.I unyabba
  1426. Xhas several flags:
  1427. X.TP 12
  1428. X.B\-m\fImem
  1429. XAssume that the input was produced for memory size
  1430. X.I mem.
  1431. X.I yabba
  1432. Xmust have been given the same value of
  1433. X.I mem.
  1434. X.I mem
  1435. Xcannot be larger than a value specified at compile-time.
  1436. XTypical values of
  1437. X.I mem
  1438. Xare 12000, 20000, 40000, 65533, 200000, 500000, and 1000000.
  1439. X.TP
  1440. X.B\-r
  1441. XAssume that the input was ``randomized''
  1442. Xby
  1443. X.I yabba.
  1444. X.I unyabba
  1445. Xwill not expect its usual header,
  1446. Xand will strip out the pseudo-random information
  1447. Xintroduced by
  1448. X.I yabba.
  1449. XCaveat:
  1450. X.I unyabba
  1451. Xnormally checks for the proper
  1452. X.B\-m
  1453. Xsetting in the input.
  1454. XUnder
  1455. X.B\-r,
  1456. Xit cannot do so.
  1457. X.TP
  1458. X.B\-R
  1459. XLook for the usual header, and complain about apparently random input.
  1460. XThis is the default.
  1461. X.TP
  1462. X.B\-v
  1463. X.I unyabba
  1464. Xwill be ``verbose'' and report compression statistics
  1465. Xto standard error.
  1466. X.TP
  1467. X.B\-q
  1468. XQuiet.
  1469. X.I unyabba
  1470. Xwill not use
  1471. Xstandard error in any way.
  1472. X.TP
  1473. X.B\-Q
  1474. XNormal level of verbosity.
  1475. X.PP
  1476. X.B\-m,
  1477. X.B\-r,
  1478. Xand
  1479. X.B\-R
  1480. Xassume a different structure for the compressed file.
  1481. XBe careful to have selected the same flags for
  1482. X.I yabba.
  1483. X.SH DIAGNOSTICS
  1484. X.TP
  1485. X\fIIn:\fB xxx \fIchars  Out:\fB xxx \fIchars  UnY'd from:\fB xx%
  1486. XThe utilizer of the computational machinery
  1487. Xhas specified the ``verbose'' option
  1488. Xto
  1489. X.I unyabba
  1490. Xvia the
  1491. Xestablishment of the character v
  1492. Xwithin an argument
  1493. Xpreceded by a hyphen.
  1494. X.TP
  1495. X\fIfatal: output error\fB
  1496. XSelf-explanatory.
  1497. X.TP
  1498. X\fIfatal: input not in right format\fB
  1499. XThe
  1500. X.I yabba
  1501. Xheader is not there.
  1502. X.TP
  1503. X\fIfatal: input has \-m xxx, I have \-m yyy\fB
  1504. XSelf-explanatory.
  1505. X.TP
  1506. X\fIfatal: input corrupt
  1507. XThe input is not a compressed file. (Note that
  1508. X.I unyabba
  1509. Xwill always detect this, unlike
  1510. X.I uncompress,
  1511. Xwhich may simply produce incorrect output.)
  1512. XDid you compress with
  1513. X.B\-r?
  1514. X.SH "EXIT CODE"
  1515. X0 normally, 1 for syntax errors or usage messages,
  1516. X2 for output errors,
  1517. X3 if the input is not in the right format,
  1518. X4 if the input was compressed with a different value of
  1519. X.I mem,
  1520. X5 if the input is corrupt.
  1521. X.SH FILES
  1522. XNone.
  1523. X.SH BUGS
  1524. XNone known.
  1525. X.SH VERSION
  1526. Xunwhap 1.00, March 19, 1991.
  1527. X.SH AUTHOR
  1528. XPlaced into the public domain by Daniel J. Bernstein.
  1529. X.SH REFERENCES
  1530. XD. J. Bernstein, ``Y coding.''
  1531. XPreprints available soon.
  1532. X.SH "SEE ALSO"
  1533. Xyabba(1),
  1534. Xcompress(1)
  1535. END_OF_FILE
  1536.   if test 2906 -ne `wc -c <'unyabba.1'`; then
  1537.     echo shar: \"'unyabba.1'\" unpacked with wrong size!
  1538.   fi
  1539.   # end of 'unyabba.1'
  1540. fi
  1541. if test -f 'yabba.1' -a "${1}" != "-c" ; then 
  1542.   echo shar: Will not clobber existing file \"'yabba.1'\"
  1543. else
  1544.   echo shar: Extracting \"'yabba.1'\" \(3586 characters\)
  1545.   sed "s/^X//" >'yabba.1' <<'END_OF_FILE'
  1546. X.TH yabba 1
  1547. X.SH NAME
  1548. Xyabba \- compress data with Y coding
  1549. X
  1550. Xwhap \- compress data with AP coding
  1551. X.SH SYNTAX
  1552. Xyabba
  1553. X[
  1554. X\fB\-m\fImem
  1555. X] [
  1556. X\fB\-z\fInum
  1557. X] [
  1558. X\fB\-Z\fIfuzz
  1559. X] [
  1560. X\fB\-qQv^rR\fI
  1561. X] [
  1562. X\fB\-ACHUVW\fI
  1563. X]
  1564. X
  1565. X\fBwhap
  1566. X[
  1567. X\fB\-m\fImem
  1568. X] [
  1569. X\fB\-z\fInum
  1570. X] [
  1571. X\fB\-Z\fIfuzz
  1572. X] [
  1573. X\fB\-qQv^rR\fI
  1574. X] [
  1575. X\fB\-ACHUVW\fI
  1576. X]
  1577. X.SH DESCRIPTION
  1578. X.I yabba
  1579. Xcompresses its standard input
  1580. Xand writes the result to its standard output.
  1581. X\fIyabba\fBd
  1582. Xfiles can be restored
  1583. Xwith
  1584. X\fIunyabba\fB.
  1585. X
  1586. X.I whap
  1587. Xis like
  1588. X.I yabba,
  1589. Xbut uses AP coding.
  1590. XWarning: If you use
  1591. X.I whap
  1592. Xexcept for experimental use,
  1593. Xyou may be infringing upon a patent.
  1594. X
  1595. XOptions
  1596. X.B ACHUVW
  1597. Xprint the authorship notice,
  1598. Xcopyright notice,
  1599. Xhelp notice,
  1600. Xshort usage summary,
  1601. Xversion number,
  1602. Xand warranty information respectively.
  1603. X
  1604. X.I yabba
  1605. Xhas several flags:
  1606. X.TP 12
  1607. X.B\-m\fImem
  1608. XProduce output for memory size
  1609. X.I mem.
  1610. X.I unyabba
  1611. Xmust be given the same value of
  1612. X.I mem.
  1613. X.I mem
  1614. Xcannot be larger than a value specified at compile-time;
  1615. Xif you compress with a
  1616. X.I mem
  1617. Xlarger than the maximum value for the
  1618. Xtarget
  1619. X.I unyabba,
  1620. Xyou will not be able to decompress the file.
  1621. XTypical values of
  1622. X.I mem
  1623. Xare 12000, 20000, 40000, 65533, 200000, 500000, and 1000000.
  1624. X.TP
  1625. X.B\-r
  1626. XProduce ``randomized'' output suitable for encryption.
  1627. X.I yabba
  1628. Xwill introduce
  1629. Xpseudo-random bits of information
  1630. Xinto the output, and will leave off its usual output header.
  1631. XNormally, for efficiency and so that
  1632. X.I yabba
  1633. Xcan produce output before seeing the end of the input,
  1634. Xcompressed texts must have some slight output redundancy.
  1635. XUnder
  1636. X.B\-r,
  1637. Xmost of this redundancy disappears
  1638. Xand almost all
  1639. X\fIY'\fBd
  1640. Xtexts are possible.
  1641. XCaveat: the beginning
  1642. Xof the output depends only
  1643. Xon the beginning
  1644. Xof the input,
  1645. Xso you should make sure
  1646. Xto
  1647. X.I precede the uncompressed input
  1648. X.I by unpredictable data
  1649. Xbefore feeding it to
  1650. X.I yabba.
  1651. X.TP
  1652. X.B\-R
  1653. XDo not randomize output, and include the usual header.
  1654. XThis is the default.
  1655. X.TP
  1656. X.B\-Z\fIfuzz
  1657. X.I yabba
  1658. Xmaintains a
  1659. X``dictionary''
  1660. Xof strings
  1661. Xadapted to the data seen so far.
  1662. XWhen
  1663. X.I yabba
  1664. Xruns out of memory (as specified by
  1665. X.B\-m),
  1666. Xit will periodically test whether the compression ratio is
  1667. Xgood enough.
  1668. XIf not, it will adapt to the next ``block''
  1669. Xof the file
  1670. Xby throwing out the dictionary and starting over.
  1671. X.I fuzz
  1672. Xhas some vaguely defined effect
  1673. Xon what ``good enough'' means;
  1674. Xthe higher
  1675. X.I fuzz
  1676. Xis, the longer
  1677. X.I yabba
  1678. Xwill hold out before clearing the dictionary.
  1679. X.I fuzz
  1680. Xis 30 by default.
  1681. X.TP
  1682. X.B\-z\fInum
  1683. X.I num
  1684. Xsets how often
  1685. X.I yabba
  1686. Xwill check for clearing the dictionary.
  1687. XThe default is every 8192 characters.
  1688. X.TP
  1689. X.B\-v
  1690. X.I yabba
  1691. Xwill be ``verbose'' and report compression statistics
  1692. Xto standard error.
  1693. X.TP
  1694. X.B\-^
  1695. XSame as
  1696. X.B\-v,
  1697. Xbut reports the percent saved rather than the percent left.
  1698. X.TP
  1699. X.B\-q
  1700. XQuiet.
  1701. X.I yabba
  1702. Xwill not use
  1703. Xstandard error in any way.
  1704. X.TP
  1705. X.B\-Q
  1706. XNormal level of verbosity.
  1707. X.PP
  1708. X.B\-m,
  1709. X.B\-r,
  1710. Xand
  1711. X.B\-R
  1712. Xchange the structure of the compressed file.
  1713. XBe careful to select the same flags for
  1714. X.I unyabba.
  1715. X.SH DIAGNOSTICS
  1716. X.TP
  1717. X\fIIn:\fB xxx \fIchars  Out:\fB xxx \fIchars  Y'd to:\fB xx%
  1718. XThe utilizer of the computational machinery
  1719. Xhas specified the ``verbose'' option
  1720. Xto
  1721. X.I yabba
  1722. Xvia the
  1723. Xestablishment of the character v
  1724. Xwithin an argument
  1725. Xpreceded by a hyphen.
  1726. X.TP
  1727. X\fIfatal: output error\fB
  1728. XSelf-explanatory.
  1729. X.SH "EXIT CODE"
  1730. X0 normally, 1 for syntax errors or usage notices,
  1731. X2 for output errors.
  1732. X.SH FILES
  1733. XNone.
  1734. X.SH BUGS
  1735. XNone known.
  1736. X.SH VERSION
  1737. Xyabba 1.00, March 19, 1991.
  1738. X.SH AUTHOR
  1739. XPlaced into the public domain by Daniel J. Bernstein.
  1740. X.SH REFERENCES
  1741. XD. J. Bernstein, ``Y coding.''
  1742. XPreprints available soon.
  1743. X.SH "SEE ALSO"
  1744. Xunyabba(1),
  1745. Xcompress(1)
  1746. END_OF_FILE
  1747.   if test 3586 -ne `wc -c <'yabba.1'`; then
  1748.     echo shar: \"'yabba.1'\" unpacked with wrong size!
  1749.   fi
  1750.   # end of 'yabba.1'
  1751. fi
  1752. echo shar: End of archive 3 \(of 4\).
  1753. cp /dev/null ark3isdone
  1754. MISSING=""
  1755. for I in 1 2 3 4 ; do
  1756.     if test ! -f ark${I}isdone ; then
  1757.     MISSING="${MISSING} ${I}"
  1758.     fi
  1759. done
  1760. if test "${MISSING}" = "" ; then
  1761.     echo You have unpacked all 4 archives.
  1762.     rm -f ark[1-9]isdone
  1763. else
  1764.     echo You still must unpack the following archives:
  1765.     echo "        " ${MISSING}
  1766. fi
  1767. exit 0
  1768. exit 0 # Just in case...
  1769.